<html>
<head>
	<title>xssJudger</title>
	<style type="text/css">
	table{
		width: 1200px;
		margin: 0 auto;
		border:1px solid;
		border-collapse:collapse;
	}
	th,td{
		text-align:center;
		font-size:20px;
		border: 1px solid;
	}
	caption{
		width: 400px;
		height: 80px;
		margin: 10px auto;
		color: blue;
		font-size: 25px;
	}
	button{
		width: 60px;
		height: 25px;
	}
	</style>
	<script type="text/javascript">
		function openXss(id){
			window.open("/myDetector/readXss/?id="+id,"_blank");

		};
		function stateChange(id,op){
			if(window.XMLHttpRequest){
				xmlhttp = new XMLHttpRequest();
			}else{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			xmlhttp.open("GET","/myDetector/xssStateChange?id="+id+"&op="+op,true);
			xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
			// xmlhttp.setRequestHeader("X-CSRFToken",csrf_token)
			xmlhttp.onreadystatechange = function(){
				if(xmlhttp.readyState == 4 && (xmlhttp.status ==200 || xmlhttp.status ==304)){
					alert("success")
				}
			};
			xmlhttp.send();
		
		}
	</script>
</head>
<body>
	<table>
		<caption>Text File List</caption>
		<tr>
			<th>id</th>
			<th>submitDate</th>
			<th>model_1</th>
			<th>model_2</th>
			<th>operation</th>
			<th>read</th>
			<th>state</th>
		</tr>
		{% for xss in xssRst %}
		<tr>
			<td>{{xss.id}}</td>
			<td>{{xss.submit_date}}</td>
			<td>{{xss.model_one_summary}}</td>
			<td>{{xss.model_two_summary}}</td>
			<td>
				<!-- <div style="color:blue">pass</div>
				<div style="color:red">refuse</div> -->
				<button onclick=stateChange({{xss.id}},'pass')>pass</button>
				<button onclick=stateChange({{xss.id}},'refuse')>refuse</button>
			</td>
			<td><button onclick=openXss({{xss.id}})>open</button></td>
			<td>{{xss.state}}</td>
		</tr>
		{% endfor %}
	</table>
</body>
</html>